<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:directive.include file="cabecera.jsp"/>

<head>
<style type="text/css">@import url(calendar-win2k-1.css);</style>
<script type="text/javascript" src="calendar.js"></script>
<script type="text/javascript" src="calendar-es.js"></script>
<script type="text/javascript" src="calendar-setup.js"></script>
</head>

<body>

<div id="calendar-container" style="float: right"></div>
    
    <form action="ListarReservasServlet" method="post" style="width: 501px; height: 255px">
    <table border="0">
    <tr><td>Fecha de Reserva</td><td><input type="text" id="date" name="date"><input type="button" id="trigger" value="..."></td></tr>
    <tr><td>Sala Reservada</td><td><select name="sala"><option value="1">Sala Rock 80's'</option><option value="2">Sala Unplugged</option><option value="3">Efectos +</option></select></td></tr>
    <tr><td><input type="submit" value="Consultar Reserva" align="Top">
	<td style="height: 125px; "></td></tr>
    </table>
    </form>
    
<script type="text/javascript"> 
  function dateChanged(calendar) {
    if (calendar.dateClicked) {
      var y = calendar.date.getFullYear();
      var m = calendar.date.getMonth();
      var d = calendar.date.getDate();
      window.location = "ListarReservasServlet";
    }
  };
 
  Calendar.setup(
    {
      flat         : "calendar-container",
      flatCallback : dateChanged
    }
  );
  
  Calendar.setup(
    {
      inputField  : "date",
      ifFormat    : "%Y-%m-%d",
      button      : "trigger"
    }
  );
  
  </script>

<table border="1" cellpadding="0" cellspacing="0">
  <tr>
    <th width="40" scope="col">Id Reserva</th>
    <th width="40" scope="col">Id Usuario</th>
    <th width="40" scope="col">Hora Inicio</th>
    <th width="40" scope="col">Total</th>
    <th width="70" scope="col">Instrumento Adic</th>
    <th width="70" scope="col">Servicio Adic</th>    
  </tr>

  <%@page import="java.util.*, studio.modelo.Reserva" %>
<%
Collection<Reserva> reserva = (ArrayList<Reserva>)request.getAttribute("Reservas");
if(reserva != null) { 
int i = 1;
for(Reserva x : reserva) {
%>  
  <tr>
    <td><% out.print(x.getIdReserva()); %></td>
    <td><% out.print(x.getUsuario_idUsuario()); %></td>
    <td><% out.print(x.getHoraInicio()); %></td>
    <td><% out.print(x.getHoraFinal()); %></td>
    <td><% out.print(x.getTotal()); %></td>
  </tr>
<% }  
  } %>
  
  </table>
<%@include file="pie.jsp" %>
</body>
</html>
